<template>
  <div>
    <el-row>
      <el-col> </el-col>
    </el-row>
    <!-- 新增/编辑 -->
    <el-dialog
      v-dialogDrag
      :title="saveTitles[saveFlg - 1] + '过滤器'"
      :visible.sync="showFilterPage"
      :before-close="beforeCloseBtn"
      :append-to-body="true"
      width="700px"
      top="5%"
    >
      <el-tabs v-model="activeName" :before-leave="leaveTab">
        <!-- 基本信息 -->
        <el-tab-pane label="基本信息" name="basicInformation">
          <el-form
            ref="basicInformationForm"
            :model="basicInformationForm"
            label-width="100px"
            label-position="right"
            :rules="basicInformationRules"
          >
            <el-form-item label="编码：" prop="filterCode">
              <el-input
                v-model="basicInformationForm.filterCode"
                :disabled="examine"
              ></el-input>
            </el-form-item>
            <el-form-item label="名称：" prop="filterName">
              <el-input
                v-model="basicInformationForm.filterName"
                :disabled="examine"
              ></el-input>
            </el-form-item>
            <el-form-item label="过滤器类型：" prop="filterType">
              <el-select
                v-model="basicInformationForm.filterType"
                :disabled="examine"
                style="width: 560px"
                placeholder="请选择过滤器"
              >
                <el-option
                  v-for="item in filterTypeOptions"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="状态：" prop="status">
              <el-select
                v-model="basicInformationForm.status"
                :disabled="examine"
                style="width: 560px"
                placeholder="请选择状态"
              >
                <el-option
                  v-for="item in statusOptions"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="权限：" prop="ruleType">
              <el-radio-group
                v-model="basicInformationForm.ruleType"
                :disabled="examine"
              >
                <el-radio label="0">任何人可读写</el-radio>
                <el-radio label="1">创建人可读写其他人可读</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="描述：" prop="descn">
              <el-input
                type="textarea"
                v-model="basicInformationForm.descn"
                :disabled="examine"
              ></el-input>
            </el-form-item>
          </el-form>
        </el-tab-pane>
        <!-- 过滤条件 -->
        <el-tab-pane label="过滤条件" name="filterCondition">
          <div class="tabBox">
            <el-form
              ref="filterConditionForm"
              :model="filterConditionForm"
              label-position="right"
              :rules="filterConditionRules"
            >
              <el-row>
                <el-col :span="12">
                  <el-form-item label="创建方式：" prop="createWay">
                    <el-radio-group
                      v-model="filterConditionForm.createWay"
                      :disabled="examine"
                    >
                      <el-radio label="1">向导方式</el-radio>
                      <el-radio label="2">手动输入</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="金融工具表选择：" prop="financialITS">
                    <el-select
                      v-model="filterConditionForm.financialITS"
                      :disabled="examine"
                      placeholder="请选择金融工具表"
                    >
                      <el-option
                        v-for="item in financialITSOptions"
                        :key="item.tableNameEn"
                        :label="item.tableNameCn$tableNameEn"
                        :value="item.tableNameEn"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </div>
          <div class="tabContent">
            <div
              class="tabContentTab"
              v-show="filterConditionForm.createWay === '1' ? true : false"
            >
              <div class="tabContentA">
                <div class="tabContentAtitle">SQL展示：</div>
                <div>
                  <el-input type="textarea" disabled v-model="tabContentAdescn">
                  </el-input>
                </div>
                <div class="tabContentAtitle">条件：</div>
                <div class="tabContentAoperate">
                  <el-row>
                    <el-col :span="14">
                      <el-form
                        ref="operationForm"
                        :model="operationForm"
                        label-width="84px"
                        label-position="right"
                        :rules="operationFormRules"
                      >
                        <el-form-item label="字段选择：" prop="fieldSelection">
                          <el-select
                            v-model="operationForm.fieldSelection"
                            :disabled="examine"
                            placeholder="请选择字段"
                          >
                            <el-option
                              v-for="item in fieldSelectionOptions"
                              :key="item.columnCn"
                              :label="item.columnCn"
                              :value="item.dataType"
                            >
                            </el-option>
                          </el-select>
                        </el-form-item>
                        <el-form-item label="操作符：" prop="operator">
                          <el-radio-group
                            v-model="operationForm.operator"
                            :disabled="examine"
                          >
                            <el-radio style="margin-right: 4px" label="1"
                              ><span class="spanTXT">包含（in）</span></el-radio
                            >
                            <el-radio style="margin-right: 4px" label="2"
                              ><span class="spanTXT"
                                >不包含（not in）</span
                              ></el-radio
                            >
                            <el-radio
                              v-if="
                                operationForm.fieldSelection === 'VARCHAR2'
                                  ? false
                                  : true
                              "
                              style="margin-right: 4px; margin-top: 10px"
                              label="3"
                              ><span class="spanTXT"
                                >在....之间（between）</span
                              ></el-radio
                            >
                          </el-radio-group>
                        </el-form-item>
                        <el-form-item label="条件输入：" prop="conditionInput">
                          <div
                            v-if="
                              operationForm.fieldSelection === 'VARCHAR2'
                                ? true
                                : false
                            "
                          >
                            <el-select
                              v-model="operationForm.conditionInput"
                              filterable
                              multiple
                              :disabled="examine"
                              placeholder="请选择维度"
                            >
                              <el-option
                                v-for="item in stringOption"
                                :key="item.columnCn"
                                :label="item.dictItemName"
                                :value="item.dictItemCode"
                              >
                                <span style="float: left">{{
                                  item.dictItemName
                                }}</span>
                                <span style="float: right">{{
                                  item.dictItemCode
                                }}</span>
                              </el-option>
                            </el-select>
                          </div>
                          <div
                            v-if="
                              operationForm.fieldSelection === 'DATE'
                                ? true
                                : false
                            "
                          >
                            <div
                              v-if="
                                operationForm.operator === '1' ? true : false
                              "
                            >
                              <span class="spanTXT">在</span>
                              <el-date-picker
                                v-model="operationForm.conditionInput"
                                :disabled="examine"
                                type="date"
                                style="width: 130px"
                                value-format="yyyy-MM-dd"
                                format="yyyy-MM-dd"
                              ></el-date-picker>
                              <span class="spanTXT">之中</span>
                            </div>
                            <div
                              v-if="
                                operationForm.operator === '2' ? true : false
                              "
                            >
                              <span class="spanTXT">不在</span>
                              <el-date-picker
                                v-model="operationForm.conditionInput"
                                :disabled="examine"
                                type="date"
                                style="width: 130px"
                                value-format="yyyy-MM-dd"
                                format="yyyy-MM-dd"
                              ></el-date-picker>
                              <span class="spanTXT">之中</span>
                            </div>
                            <div
                              v-if="
                                operationForm.operator === '3' ? true : false
                              "
                            >
                              <el-date-picker
                                v-model="operationForm.conditionInput"
                                type="date"
                                style="width: 130px"
                                :disabled="examine"
                                value-format="yyyy-MM-dd"
                                format="yyyy-MM-dd"
                              ></el-date-picker>
                              <span class="spanTXT">和</span>
                              <el-date-picker
                                v-model="operationForm.conditionInput"
                                type="date"
                                style="width: 130px"
                                :disabled="examine"
                                value-format="yyyy-MM-dd"
                                format="yyyy-MM-dd"
                              ></el-date-picker>
                              <span class="spanTXT">之间</span>
                            </div>
                            <div
                              v-if="
                                operationForm.operator === '' ? true : false
                              "
                            >
                              <span class="spanTXT" style="color: red"
                                >(提示：请先选择操作符再操作)</span
                              >
                            </div>
                          </div>
                          <div
                            v-if="
                              operationForm.fieldSelection === 'NUMBER'
                                ? true
                                : false
                            "
                          >
                            <div
                              v-if="
                                operationForm.operator === '1' ? true : false
                              "
                            >
                              <span class="spanTXT">在</span>
                              <el-input
                                v-model="operationForm.conditionInput"
                                :disabled="examine"
                                style="width: 130px"
                              ></el-input>
                              <span class="spanTXT">之中</span>
                            </div>
                            <div
                              v-if="
                                operationForm.operator === '2' ? true : false
                              "
                            >
                              <span class="spanTXT">不在</span>
                              <el-input
                                v-model="operationForm.conditionInput"
                                :disabled="examine"
                                style="width: 130px"
                              ></el-input>
                              <span class="spanTXT">之中</span>
                            </div>
                            <div
                              v-if="
                                operationForm.operator === '3' ? true : false
                              "
                            >
                              <el-input
                                v-model="operationForm.conditionInput"
                                :disabled="examine"
                                style="width: 130px"
                              ></el-input>
                              <span class="spanTXT">和</span>
                              <el-input
                                v-model="operationForm.conditionInput"
                                :disabled="examine"
                                style="width: 130px"
                              ></el-input>
                              <span class="spanTXT">之间</span>
                            </div>
                            <div
                              v-if="
                                operationForm.operator === '' ? true : false
                              "
                            >
                              <span class="spanTXT" style="color: red"
                                >(提示：请先选择操作符再操作)</span
                              >
                            </div>
                          </div>
                          <div
                            v-if="
                              operationForm.fieldSelection === '' ? true : false
                            "
                          >
                            <span class="spanTXT" style="color: red"
                              >(提示：请先选择金融工具表和字段再操作)</span
                            >
                          </div>
                        </el-form-item>
                      </el-form>
                    </el-col>
                    <el-col :span="10">
                      <el-table
                        ref="SQLTable"
                        style="height: 200px"
                        :data="SQLTableData"
                      >
                        <el-table-column
                          prop="conditionFlag"
                          :show-overflow-tooltip="true"
                          align="center"
                          header-align="center"
                          label="描述"
                        >
                        </el-table-column>
                        <el-table-column
                          prop="sql"
                          :show-overflow-tooltip="true"
                          align="center"
                          header-align="center"
                          label="SQL"
                        >
                        </el-table-column>
                        <el-table-column
                          prop="operate"
                          align="center"
                          header-align="center"
                          label="操作"
                        >
                          <template>
                            <div>删除</div>
                          </template>
                        </el-table-column>
                      </el-table>
                    </el-col>
                  </el-row>
                </div>
              </div>
            </div>
            <div
              class="tabContentTab"
              v-show="filterConditionForm.createWay === '1' ? false : true"
            >
              <div class="tabContentB">
                <div class="tabContentBtitle">
                  手动输入(示例：month1Val>1000 and month2Val!='2000')：
                </div>
                <div>
                  <el-input
                    type="textarea"
                    :disabled="examine"
                    v-model="tabContentBdescn"
                  >
                  </el-input>
                </div>
                <div class="tabContentBtitle">表字段(可单击添加)：</div>
                <div class="tabContentBoperate">
                  <el-tag
                    v-for="item in tableFieldList"
                    :disabled="examine"
                    :key="item.columnEn"
                    style="margin: 10px"
                    effect="dark"
                    @click="tagBtn(item.columnEn)"
                  >
                    {{ item.columnEn + "(" + item.columnCn + ")" }}
                  </el-tag>
                </div>
              </div>
            </div>
          </div>
        </el-tab-pane>
      </el-tabs>
      <div slot="footer">
        <el-button @click="confirmTne">确 定</el-button>
        <el-button @click="cancelTne">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
// import { publicManage_dat } from '@/api/index'
import moment from "moment";
export default {
  props: {
    toShowFilterPage: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      //   列表    ####################################################################################################
      showFilterPage: false,
      total: 50,
      saveFlg: 3,
      saveTitles: ["新增", "编辑", "查看", "复制"],
      searchForm: {
        filterCode: "",
        filterName: "",
        page: 1,
        size: 15,
      },
      checkList: [
        "过滤器编码",
        "过滤器名称",
        "过滤器类型",
        "状态",
        "描述",
        "创建人",
        "创建时间",
        "修改人",
        "修改时间",
      ],
      textData: [
        { prop: "filterCode", label: "过滤器编码" },
        { prop: "filterName", label: "过滤器名称" },
        { prop: "filterType", label: "过滤器类型" },
        { prop: "status", label: "状态" },
        { prop: "descn", label: "描述" },
        { prop: "creator", label: "创建人" },
        { prop: "createdTm", label: "创建时间" },
        { prop: "modifier", label: "修改人" },
        { prop: "modifiedTm", label: "修改时间" },
      ],
      tableData: [
        {
          creator: "sys",
          createdTm: 1603784300253,
          modifier: null,
          modifiedTm: null,
          status: "1",
          filterId: "40288dfd7548c74a017568fe56dd00cb",
          filterCode: "FT_20102700001",
          filterName: "123",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sys",
          createdTm: 1603844576627,
          modifier: null,
          modifiedTm: null,
          status: "1",
          filterId: "40288dfd7548c74a01756c96157500cf",
          filterCode: "FT_20102800001",
          filterName: "1",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "0",
          descn: null,
        },
        {
          creator: "vprisk",
          createdTm: 1558356966788,
          modifier: "sys",
          modifiedTm: 1605509761518,
          status: "1",
          filterId: "40288dfd70d1d7600170d28b74760065",
          filterCode: "FT_20031300006",
          filterName: "过滤器-国际业务条线",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sys",
          createdTm: 1591076020702,
          modifier: "sys",
          modifiedTm: 1594889067106,
          status: "1",
          filterId: "40288dfd7272ef180172738561e0004c",
          filterCode: "FT_20060200002",
          filterName: "过滤-市行",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sysadmin",
          createdTm: 1543805013000,
          modifier: "sysadmin",
          modifiedTm: 1556163255000,
          status: "1",
          filterId: "40288dfa6762323b016771f30e14014e",
          filterCode: "FT_18120300004",
          filterName: "过滤器-总行",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "0",
          descn: null,
        },
        {
          creator: "sysadmin",
          createdTm: 1543804998000,
          modifier: "sysadmin",
          modifiedTm: 1551080647000,
          status: "1",
          filterId: "40288dfa6762323b016771fc4e590151",
          filterCode: "FT_18120300007",
          filterName: "过滤器-分行",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sysadmin",
          createdTm: 1544424535000,
          modifier: "sysadmin",
          modifiedTm: 1551080672000,
          status: "2",
          filterId: "40288dfa6795b81d016796e0341402e5",
          filterCode: "FT_18121000001",
          filterName: "过滤器-支行",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sysadmin",
          createdTm: 1543804998000,
          modifier: "sysadmin",
          modifiedTm: 1551080678000,
          status: "1",
          filterId: "40288dfa6762323b016771f2d496014d",
          filterCode: "FT_18120300003",
          filterName: "过滤器-部门",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sysadmin",
          createdTm: 1543805026000,
          modifier: "sysadmin",
          modifiedTm: 1551080691000,
          status: "1",
          filterId: "40288dfa6762323b016771f33f19014f",
          filterCode: "FT_18120300005",
          filterName: "过滤器-营销费用",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sysadmin",
          createdTm: 1543805013000,
          modifier: "sysadmin",
          modifiedTm: 1551080701000,
          status: "1",
          filterId: "40288dfa6795b81d016796eed7c40348",
          filterCode: "FT_18121000005",
          filterName: "过滤器-贷款科目",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sysadmin",
          createdTm: 1543560864000,
          modifier: "sysadmin",
          modifiedTm: 1551080711000,
          status: "1",
          filterId: "40288dfa6762323b01676365a4e000c4",
          filterCode: "FT_18113000005",
          filterName: "过滤器-存款科目",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sysadmin",
          createdTm: 1543805037000,
          modifier: "sysadmin",
          modifiedTm: 1551080723000,
          status: "1",
          filterId: "40288dfa6762323b016771f36c920150",
          filterCode: "FT_18120300006",
          filterName: "过滤器-同业科目",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sys",
          createdTm: 1603784300253,
          modifier: null,
          modifiedTm: null,
          status: "1",
          filterId: "40288dfd7548c74a0175cff95c6704a6",
          filterCode: "FT_20111600002",
          filterName: "123",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sys",
          createdTm: 1603784300253,
          modifier: null,
          modifiedTm: null,
          status: "1",
          filterId: "40288dfd7548c74a0175ab708e4003a8",
          filterCode: "FT_20110900001",
          filterName: "123",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sys",
          createdTm: 1591076020702,
          modifier: "sys",
          modifiedTm: 1594889067106,
          status: "1",
          filterId: "40288dfd7548c74a017549a135960002",
          filterCode: "FT_20102100002",
          filterName: "过滤-市行",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sys",
          createdTm: 1591076020702,
          modifier: "sys",
          modifiedTm: 1594889067106,
          status: "1",
          filterId: "40288dfd7548c74a017549a0f0760000",
          filterCode: "FT_20102100001",
          filterName: "过滤-市行",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: null,
        },
        {
          creator: "sys",
          createdTm: 1603173971436,
          modifier: null,
          modifiedTm: null,
          status: "1",
          filterId: "40288dfd749095f20175449d75ff0897",
          filterCode: "FT_20102000001",
          filterName: "工",
          filterType: "1",
          ruleType: "0",
          sourceType: null,
          isNavigator: "1",
          descn: "工工工工",
        },
      ],
      //   弹出框   ####################################################################################################
      //tab切换
      activeName: "basicInformation",
      //开关
      stopSwitch: false,
      //查看
      examine: true,
      //基本信息-表单
      basicInformationForm: {
        filterCode: "",
        filterName: "",
        filterType: "",
        status: "",
        ruleType: "",
        descn: "",
      },
      //基本信息-表单校验
      basicInformationRules: {
        filterCode: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur",
          },
        ],
        filterName: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur",
          },
        ],
        filterType: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur",
          },
        ],
        status: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur",
          },
        ],
        ruleType: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur",
          },
        ],
      },
      //基本信息-表单-过滤器类型-下拉
      filterTypeOptions: [
        {
          value: "1",
          label: "Data Element",
        },
      ],
      //基本信息-表单-状态-下拉
      statusOptions: [
        {
          value: "1",
          label: "启用",
        },
        {
          value: "2",
          label: "停用",
        },
      ],
      //过滤条件-顶部表单
      filterConditionForm: {
        createWay: "1",
        financialITS: "",
      },
      //过滤条件-顶部表单-检验
      filterConditionRules: {
        createWay: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur",
          },
        ],
        financialITS: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur",
          },
        ],
      },
      //过滤条件-顶部表单-金融工具表-下拉
      financialITSOptions: [
        {
          tableNameEn: "ALM",
          isModule: "1",
          tableNameCn: "当前头寸",
          tableNameCn$tableNameEn: "当前头寸--ALM",
        },
        {
          tableNameEn: "FTP_POSITION_",
          isModule: "1",
          tableNameCn: "默认头寸接口表",
          tableNameCn$tableNameEn: "默认头寸接口表--FTP_POSITION_",
        },
        {
          tableNameEn: "CA_GRPL_INF",
          isModule: "1",
          tableNameCn: "总账表模版",
          tableNameCn$tableNameEn: "总账表模版--CA_GRPL_INF",
        },
        {
          tableNameEn: "CA_ACCT_INF",
          isModule: "1",
          tableNameCn: "账户表模版",
          tableNameCn$tableNameEn: "账户表模版--CA_ACCT_INF",
        },
        {
          tableNameEn: "CA_REASON_INF",
          isModule: "1",
          tableNameCn: "动因表模版",
          tableNameCn$tableNameEn: "动因表模版--CA_REASON_INF",
        },
      ],
      //向导方式-SQL展示
      tabContentAdescn: "",
      //向导方式-条件-左侧操作
      operationForm: {
        fieldSelection: "",
        operator: "",
        conditionInput: "",
      },
      operationFormRules: {
        fieldSelection: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur",
          },
        ],
        operator: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur",
          },
        ],
        conditionInput: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur",
          },
        ],
      },
      //向导方式-条件-左侧操作-字段选择下拉
      fieldSelectionOptions: [
        {
          columnCn: "动因值",
          dataType: "NUMBER",
          relatedDimensionCode1: null,
          columnEn: "Reason_Val",
          columnCn$columnEn: "动因值--Reason_Val",
        },
        {
          columnCn: "数据日期",
          dataType: "DATE",
          relatedDimensionCode1: null,
          columnEn: "Data_Dt",
          columnCn$columnEn: "数据日期--Data_Dt",
        },
        {
          columnCn: "机构代码",
          dataType: "VARCHAR2",
          relatedDimensionCode1: "OrganUnit",
          columnEn: "Org_Cd",
          columnCn$columnEn: "机构代码--Org_Cd",
        },
        {
          columnCn: "业务条线代码",
          dataType: "VARCHAR2",
          relatedDimensionCode1: "00003",
          columnEn: "Biz_Line_Cd",
          columnCn$columnEn: "业务条线代码--Biz_Line_Cd",
        },
        {
          columnCn: "科目代码",
          dataType: "VARCHAR2",
          relatedDimensionCode1: "00004",
          columnEn: "Sbjt_Cd",
          columnCn$columnEn: "科目代码--Sbjt_Cd",
        },
        {
          columnCn: "匹配字段",
          dataType: "VARCHAR2",
          relatedDimensionCode1: "match_id",
          columnEn: "Prd_Cd",
          columnCn$columnEn: "匹配字段--Prd_Cd",
        },
        {
          columnCn: "关联动因代码",
          dataType: "VARCHAR2",
          relatedDimensionCode1: "treasurer",
          columnEn: "Rel_Reason_Cd",
          columnCn$columnEn: "关联动因代码--Rel_Reason_Cd",
        },
      ],
      //向导方式-条件-左侧操作-字符类型下拉
      stringOption: [
        {
          creator: null,
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          dictItemId: "40288dfd72728d94017272d9f5740043",
          dictItemCode: "850105",
          dictItemName: "成都分行政策业务部",
          descn: null,
          isLeaf: null,
          relatedDicttypeCode: null,
          seq: null,
          status: null,
        },
        {
          creator: null,
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          dictItemId: "40288dfd72728d940172729ad755000d",
          dictItemCode: "01",
          dictItemName: "总行",
          descn: null,
          isLeaf: null,
          relatedDicttypeCode: null,
          seq: null,
          status: null,
        },
        {
          creator: null,
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          dictItemId: "40288dfd72728d94017272da4b080045",
          dictItemCode: "850106",
          dictItemName: "成都分行创新业务部",
          descn: null,
          isLeaf: null,
          relatedDicttypeCode: null,
          seq: null,
          status: null,
        },
        {
          creator: null,
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          dictItemId: "300000000087",
          dictItemCode: "6401",
          dictItemName: "泛鹏银行忠县支行",
          descn: "泛鹏银行忠县支行",
          isLeaf: null,
          relatedDicttypeCode: null,
          seq: null,
          status: null,
        },
        {
          creator: null,
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          dictItemId: "300000000088",
          dictItemCode: "6501",
          dictItemName: "泛鹏银行璧山支行",
          descn: "泛鹏银行璧山支行",
          isLeaf: null,
          relatedDicttypeCode: null,
          seq: null,
          status: null,
        },
        {
          creator: null,
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          dictItemId: "300000000086",
          dictItemCode: "6301",
          dictItemName: "泛鹏银行荣昌支行",
          descn: "泛鹏银行荣昌支行",
          isLeaf: null,
          relatedDicttypeCode: null,
          seq: null,
          status: null,
        },
        {
          creator: null,
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          dictItemId: "300000000089",
          dictItemCode: "6502",
          dictItemName: "泛鹏银行青杠支行",
          descn: "泛鹏银行青杠支行",
          isLeaf: null,
          relatedDicttypeCode: null,
          seq: null,
          status: null,
        },
        {
          creator: null,
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          dictItemId: "300000000090",
          dictItemCode: "6601",
          dictItemName: "泛鹏银行綦江支行",
          descn: "泛鹏银行綦江支行",
          isLeaf: null,
          relatedDicttypeCode: null,
          seq: null,
          status: null,
        },
        {
          creator: null,
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          dictItemId: "300000000091",
          dictItemCode: "6701",
          dictItemName: "泛鹏银行秀山支行",
          descn: "泛鹏银行秀山支行",
          isLeaf: null,
          relatedDicttypeCode: null,
          seq: null,
          status: null,
        },
        {
          creator: null,
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          dictItemId: "300000000092",
          dictItemCode: "6702",
          dictItemName: "泛鹏银行秀山五岳广场支行",
          descn: "泛鹏银行秀山五岳广场支行",
          isLeaf: null,
          relatedDicttypeCode: null,
          seq: null,
          status: null,
        },
      ],
      //向导方式-条件-右侧表单
      SQLTableData: [
        {
          filtersqlId: "40288dfd7548c74a0175da7372ac04e9",
          filtersqlCode: "FT_20111800007",
          sql: " (Biz_Line_Cd in ('T0001')) ",
          seq: null,
          addFlag: null,
          conditionFlag: "表CA_REASON_INF的字段Biz_Line_Cd在T0001之内",
          tablenameEn: "CA_REASON_INF",
          columnEn: "Biz_Line_Cd",
          isNavigator: "1",
          colType: "1",
          dimVal: "T0001",
          creator: null,
          createdTm: null,
          modifier: null,
          modifiedTm: null,
        },
        {
          filtersqlId: "40288dfd7548c74a0175da6e0f4a04e8",
          filtersqlCode: "FT_20111800007",
          sql: " (Biz_Line_Cd in ('T0001')) ",
          seq: null,
          addFlag: null,
          conditionFlag: "表CA_REASON_INF的字段Biz_Line_Cd在T0001之内",
          tablenameEn: "CA_REASON_INF",
          columnEn: "Biz_Line_Cd",
          isNavigator: "1",
          colType: "1",
          dimVal: "T0001",
          creator: null,
          createdTm: null,
          modifier: null,
          modifiedTm: null,
        },
      ],
      //手动输入-SQL标签按钮
      tableFieldList: [
        {
          columnCn: "动因值",
          dataType: "NUMBER",
          relatedDimensionCode1: null,
          columnEn: "Reason_Val",
          columnCn$columnEn: "动因值--Reason_Val",
        },
        {
          columnCn: "数据日期",
          dataType: "DATE",
          relatedDimensionCode1: null,
          columnEn: "Data_Dt",
          columnCn$columnEn: "数据日期--Data_Dt",
        },
        {
          columnCn: "机构代码",
          dataType: "VARCHAR2",
          relatedDimensionCode1: "OrganUnit",
          columnEn: "Org_Cd",
          columnCn$columnEn: "机构代码--Org_Cd",
        },
        {
          columnCn: "业务条线代码",
          dataType: "VARCHAR2",
          relatedDimensionCode1: "00003",
          columnEn: "Biz_Line_Cd",
          columnCn$columnEn: "业务条线代码--Biz_Line_Cd",
        },
        {
          columnCn: "科目代码",
          dataType: "VARCHAR2",
          relatedDimensionCode1: "00004",
          columnEn: "Sbjt_Cd",
          columnCn$columnEn: "科目代码--Sbjt_Cd",
        },
        {
          columnCn: "匹配字段",
          dataType: "VARCHAR2",
          relatedDimensionCode1: "match_id",
          columnEn: "Prd_Cd",
          columnCn$columnEn: "匹配字段--Prd_Cd",
        },
        {
          columnCn: "关联动因代码",
          dataType: "VARCHAR2",
          relatedDimensionCode1: "treasurer",
          columnEn: "Rel_Reason_Cd",
          columnCn$columnEn: "关联动因代码--Rel_Reason_Cd",
        },
      ],
      //手动输入-SQL展示
      tabContentBdescn: "",
    };
  },
  // created() {
  //     this.searchFunc()
  // },
  computed: {
    columnState() {
      let arr = [],
        arr1 = this.textData,
        arr2 = this.checkList;
      for (let i = 0; i < arr1.length; i++) {
        let flg = false;
        for (let j = 0; j < arr2.length; j++) {
          if (arr1[i].label === arr2[j]) {
            flg = true;
          }
        }
        arr.push(flg);
      }
      return arr;
    },
  },
  mounted() {},

  watch: {
    toShowFilterPage(val) {
      //  handler(newVal,oldVal) {
      console.log("bbb");
      console.log(val);
      this.showFilterPage = val;
    },
  },

  methods: {
    // //   删除
    delFunc() {
      let selection = this.$refs.multipleTable.selection;
      if (selection.length < 1) {
        return this.$message.warning("请选择要删除的数据");
      }
      this.$confirm("您确定要删除选中数据吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          const paramData = [];
          selection.forEach((element) => {
            paramData.push(element.reserveId);
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //   查看
    checkFunc() {
      this.saveFlg = 3;
      let selection = this.$refs.multipleTable.selection;
      if (selection.length != 1) {
        return this.$message.warning("请选择一条数据进行修改");
      }
      let row = selection[0];
      let form = { ...row };
      this.saveForm = form;
      this.stopSwitch = true;
      this.examine = true;
      this.showFilterPage = true;
    },

    //   弹出框   ##################################################################################################################
    //   关闭之前触发
    beforeCloseBtn(done) {
      done();
      this.stopSwitch = false;
      this.examine = false;
      this.activeName = "basicInformation";
      this.$refs.basicInformationForm.clearValidate();
      // this.$refs.basicInformationForm.resetFields()
    },
    //   Tab切换守卫钩子
    leaveTab(val, oldVal) {
      // if (val === 'filterCondition' && oldVal === 'basicInformation') {
      //     if (this.stopSwitch) {
      //         return true
      //     } else {
      //         this.$message({
      //             message: '请先保存基本信息数据！',
      //             type: 'warning',
      //         })
      //         return false
      //     }
      // }
      return true;
    },
    //   新增编辑-确定
    confirmTne() {
      switch (this.saveFlg) {
        case 1:
          console.log(this.basicInformationForm);
          this.$refs.basicInformationForm.validate((valid) => {
            if (valid) {
              this.stopSwitch = true;
              this.activeName = "filterCondition";
              // publicManage_dat
              //     .dimReservesRatioSave(this.saveForm)
              //     .then((res) => {
              //         if (res.code == 200) {
              //             this.$message({
              //                 type: 'success',
              //                 message: '保存成功',
              //             })
              //             this.searchFunc()
              //             this.toShowFilterPage = false
              //         }
              //     })
            }
          });
          break;
        case 2:
          console.log(this.basicInformationForm);
          this.$refs.basicInformationForm.validate((valid) => {
            if (valid) {
              this.stopSwitch = true;
              this.activeName = "filterCondition";
              // publicManage_dat
              //     .dimReservesRatioSave(this.saveForm)
              //     .then((res) => {
              //         if (res.code == 200) {
              //             this.$message({
              //                 type: 'success',
              //                 message: '保存成功',
              //             })
              //             this.searchFunc()
              //             this.toShowFilterPage = false
              //         }
              //     })
            }
          });
          break;
        default:
          break;
      }
    },
    //   新增编辑-取消
    cancelTne() {
      this.showFilterPage = false;
      this.stopSwitch = false;
      this.examine = false;
      this.activeName = "basicInformation";
      this.$refs.basicInformationForm.clearValidate();
    },
    //   手动输入-SQL标签按钮
    tagBtn(val) {
      let str = "";
      str = this.tabContentBdescn.concat(val);
      this.tabContentBdescn = str;
    },
  },
};
</script>
<style lang="scss" scoped>
.tabBox {
  background: #f5f5f5;
  width: 660px;
  height: 34px;
  border-radius: 4px;
}
.tabContent {
  width: 660px;
  .tabContentTab {
    width: 100%;
    .tabContentA {
      .tabContentAtitle {
        background: #f5f5f5;
        width: 660px;
        height: 34px;
        border-radius: 4px;
        font-size: 14px;
        font-weight: 900;
        line-height: 34px;
        margin-top: 20px;
        margin-bottom: 5px;
        padding-left: 10px;
      }
      .tabContentAoperate {
        width: 660px;
        height: 200px;
      }
    }
    .tabContentB {
      .tabContentBtitle {
        background: #f5f5f5;
        width: 660px;
        height: 34px;
        border-radius: 4px;
        font-size: 14px;
        font-weight: 900;
        line-height: 34px;
        margin-top: 20px;
        margin-bottom: 5px;
        padding-left: 10px;
      }
      .tabContentBoperate {
        width: 660px;
        margin-bottom: 10px;
      }
    }
  }
}
.spanTXT {
  font-size: 12px;
}
</style>